using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.HelpCategories;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects;
namespace BusinessObjects.BO_GetObjects
{
    public static class BO_HelpCategories
    {

        public static DataTable Search(int category_id)
        {
            try
            {
                BOHelpCategories_Search action = new BOHelpCategories_Search();
                usp_HelpCategories_Search entity = new usp_HelpCategories_Search();
                entity.CATEGORY_ID = category_id;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable SearchByParent(int parent_id)
        {
            try
            {
                BOHelpCategories_Search_By_Parent action = new BOHelpCategories_Search_By_Parent();
                usp_HelpCategories_Search_By_Parent entity = new usp_HelpCategories_Search_By_Parent();
                entity.PARENT_ID = parent_id;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Insert(int parent_id, string category_name, string thumb_icon, string description, int sort_display, int alter_sort, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOHelpCategories_Insert action = new BOHelpCategories_Insert();
                usp_HelpCategories_Insert entity = new usp_HelpCategories_Insert();
                entity.PARENT_ID = parent_id;
                entity.CATEGORY_NAME = category_name;
                entity.DESCRIPTION = description;
                entity.SORT_DISPLAY = sort_display;
                entity.ALTER_SORT = alter_sort;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                entity.THUMB_ICON = thumb_icon;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static string Update(int category_id, int parent_id, string category_name, string thumb_icon, string description, int sort_display, int alter_sort, DateTime created_date, string created_by, DateTime modify_date, string modify_by, bool status)
        {
            try
            {
                BOHelpCategories_Update action = new BOHelpCategories_Update();
                usp_HelpCategories_Update entity = new usp_HelpCategories_Update();
                entity.CATEGORY_ID = category_id;
                entity.PARENT_ID = parent_id;
                entity.CATEGORY_NAME = category_name;
                entity.DESCRIPTION = description;
                entity.SORT_DISPLAY = sort_display;
                entity.ALTER_SORT = alter_sort;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.STATUS = status;
                entity.THUMB_ICON = thumb_icon;

                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool Delete(int category_id)
        {
            try
            {
                BOHelpCategories_Delete action = new BOHelpCategories_Delete();
                usp_HelpCategories_Delete entity = new usp_HelpCategories_Delete();
                entity.CATEGORY_ID = category_id;

                return action.ExecuteAndReturnBooleanValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static DataTable SelectSameParent(int category_id, int category_id_crr)
        {
            try
            {
                BOHelpCategories_Same_Parent action = new BOHelpCategories_Same_Parent();
                usp_HelpCategories_Same_Parent entity = new usp_HelpCategories_Same_Parent();
                entity.CATEGORY_ID = category_id;
                entity.CATEGORY_ID_CRR = category_id_crr;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static DataTable UpdateParent(int category_id, int category_id_cur)
        {
            try
            {
                BOHelpCategories_Update_Parent action = new BOHelpCategories_Update_Parent();
                usp_HelpCategories_Update_Parent entity = new usp_HelpCategories_Update_Parent();
                entity.CATEGORY_ID = category_id;
                entity.CATEGORY_ID_CUR = category_id_cur;

                return action.ExecuteAndReturnDataTable(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static string UpDown(int category_id, int current_category_id, int isup)
        {
            try
            {
                BOHelpCategories_UpDown action = new BOHelpCategories_UpDown();
                usp_HelpCategories_UpDown entity = new usp_HelpCategories_UpDown();
                entity.CATEGORY_ID = category_id;
                entity.ISUP = isup;
                entity.CurrentCATEGORY_ID = current_category_id;
                return action.ExecuteAndReturnStringValue(entity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}

